﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
namespace OnlineMediaAnalyzer.Models
{
    public class Feed
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Name is required")]
        [StringLength(32, ErrorMessage = "Name length should be less than 32")]
        public string Name { get; set; }

        [Required(ErrorMessage = "URL is required")]
        [StringLength(256, ErrorMessage = "Name length should be less than 256")]
        public string Url { get; set; }

        [Required(ErrorMessage = "Channel is required")]
        public int ChannelID { get; set; }
        public virtual Channel Channel { get; set; }

        [Required(ErrorMessage = "RSS map is required")]
        public int RSSMapID { get; set; }
        public virtual RSSMap RSSMap { get; set; }

        public virtual ICollection<Article> Articles { get; set; }
        public virtual ICollection<FeedParty> FeedParties { get; set; }
        public virtual ICollection<MemberMention> MemberMentions { get; set; }
        public virtual ICollection<FeedStatistic> FeedStatistics { get; set; }

        public string Self
        {
            get
            {
                return string.Format(CultureInfo.CurrentCulture,
                    "api/feeds/{0}", this.ID);
            }
            set { }
        }
    }
}